package com.sakiko.audiobook.album.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sakiko.audiobook.model.album.TrackStat;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface TrackStatMapper extends BaseMapper<TrackStat> {

    /**
     * 更新声音属性
     *
     * @param count
     * @param trackId
     * @param statType
     */
    @Update("update track_stat set stat_num = stat_num + #{count} where track_id = #{trackId} and stat_type = #{statType} and is_deleted = 0")
    int trackStatUpdate(@Param("count") Integer count, @Param("trackId") Long trackId, @Param("statType") String statType);
}
